package Day2025_02_22;

public class LeetCode69 {
    public int mySqrt(int x) {
        if (x <= 1) return x;
        int left = 1, right = x;
        while (left < right) {
            int mid = left + (right - left + 1) / 2;
            if ((long) mid * mid <= x) left = mid;
            else right = mid - 1;
        }
        return left;
    }

    public static void main(String[] args) {
        LeetCode69 leetCode69 = new LeetCode69();
        System.out.println(leetCode69.mySqrt(2147483647));
    }
}
